//
// Created by Castle-Moriarty on 2025/11/3.
//

#include <iostream>
using namespace std;

int main() {


    auto sayHello =  [](){
        cout << "hello lambda " << endl;
    };
    sayHello();

    // Declare a lambda function and call it directly
    []() {
        cout << "hello world" << endl;
    }();

    // lambda function takes parameters
    [](double a,double b) {
        cout << "a + b = " << (a + b)<< endl;
    }(10.2,11.1);

    auto sum = [](double a,double b) {
        cout << "a + b = " << (a + b)<< endl;
    };
    sum(10.0,5.0);
    sum(20.0,6.0);

    // lambda function that returns something
    auto result = [](int a,int b) {
        return a + b;
    }(10,20);
    cout << "result : " << result << endl;

    auto sum2 = [](int a,int b) {
        return a + b;
    };
    auto sumResult = sum2(1,2);
    cout << "sumResult : " << sumResult << endl;


    auto func3 = [](int a,int b)-> int{
        return a + b;
    };

    auto func4 = [](int a,int b){
        return a + b;
    };





    cout << "Done:" << endl;


    return 0;
}